package com.kotasoft.iip.services;

import javax.inject.Inject;

import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;

import com.kotasoft.iip.action.insurance.SwitchAction;
import com.kotasoft.iip.integration.Routes;
import com.kotasoft.iip.model.Message;
import com.kotasoft.iip.model.insurance.Order;

public class SwitchActionService {

	@Inject
	private CamelContext camelContext;

	@SuppressWarnings("unchecked")
	public Message<Order> process(SwitchAction action) {
		ProducerTemplate producer = camelContext.createProducerTemplate();
		return producer.requestBody(Routes.ORDER_INPUT_QUEUE, action, Message.class);
	}
}
